import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
Vue.prototype.req=function(obj){
  uni.request({
       url: 'http://public.huziqiqi.top/api/index/zf?url=' + obj.url,
       data:{
         // token: wx.getStorageSync('user').token,
         // token_tel: wx.getStorageSync('user').tel,
         ...obj.data,
       } ,
       method: 'POST',
       // dataType: 'json', 
       // header: {'content-type':'application/json'},
       header: {
       	'content-type': 'application/x-www-form-urlencoded', 
       },
       dataType: 'json',
       responseType: 'text',
       success: (res) => {
            console.log(res.data);
         
         // wx.hideLoading();
         if (res.data.success=="true") {
         obj.callback && obj.callback(res.data);
         }
         else if(res.data.success == "falseToken") {
           wx.clearStorageSync("user");
         }
         else {
           console.log(res.data.desc);
           uni.showModal({
             title: '提示',
             content: res.data.desc,
             showCancel: false,
             confirmText: '确定',
             confirmColor: '#3CC51F',
             success: (result) => {
               if (result.confirm) {
                 
               }
             },
             fail: () => {},
             complete: () => {}
           });
             
         }
       },
       fail: () => {},
       complete: () => {}
     });
      
}
// app.$req=
